package com.cloud.lcnpay.controller;

import com.cloud.lcnpay.dao.TxPayMapper;
import com.cloud.lcnpay.entity.TxPay;
import com.codingapi.txlcn.tc.annotation.LcnTransaction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MainController {

    @Autowired
    private TxPayMapper payMapper;

    @PostMapping("/payOrder")
    @Transactional
    @LcnTransaction
    public String payOrder(@RequestBody TxPay pay){
        payMapper.insertTxPay(pay);
        return "付款成功";
    }
}
